<template>
    <view>
        <mescroll-uni
            ref="mescrollRef"
            @init="mescrollInit"
            :height="height"
            :down="downOption"
            @down="downRefresh"
            :up="upOption"
            @up="getData">
            <order-item v-for="(item, index) in datas" :state="state" :key="item.ID" :data="item"></order-item>
        </mescroll-uni>
    </view>
</template>
<script>
// import {
// 	mapGetters
// } from 'vuex'
import orderItem from "@/pages_supplier/components/vip/order-item.vue"
import { GetMemberProductList } from "@/pages_supplier/service/api/product.js"

export default {
    props: {
        height: {
            type: String,
            default: "100px",
        },
        state: {
            type: Number,
            default: 1,
        },
        requestData: {
            type: Object,
            default: {},
        },
    },
    components: {
        orderItem,
    },
    data() {
        return {
            datas: [],
            data: [],
            productList: [],
            param: {},
            downOption: {
                use: true,
            },
        }
    },
    // watch: {
    // 	//监听更新
    // 	getUpOrderView(e) {
    // 		this.refresh(this.requestData)
    // 	}
    // },
    // computed: {
    // 	...mapGetters([
    // 		'getUpOrderView'
    // 	])
    // },
    mounted() {
        //#ifndef MP
        this.refresh(this.requestData)
        //#endif
        console.log(this.state)
    },
    methods: {
        //获取列表数据
        getData(page) {
            let path = "?isSetPrice=" + this.state
            let param = this.param
            param.pageSize = page.size
            param.pageIndex = page.num
            GetMemberProductList(path, param).then((res) => {
                if (res.State == 1) {
                    this.mescroll.endBySize(res.Data.length, res.RecordAmout)
                    this.datas = this.datas.concat(res.Data)
                } else {
                    this.mescroll.endBySize(0, 0)
                }
            })
        },
        //刷新
        refresh(requestData) {
            this.downRefresh(requestData, true)
        },
        //刷新
        downRefresh(requestData, isSetParam = false) {
            this.datas = []
            if (isSetParam) {
                this.param = requestData
            }
            this.mescroll.resetUpScroll()
        },
    },
}
</script>

<style lang="scss">
.footer {
    width: 750rpx;
    height: 120rpx;
    background: #ffffff;
    box-shadow: 0px -2rpx 6rpx 0px rgba(0, 0, 0, 0.1);
    position: fixed;
    left: 0;
    bottom: 0;

    .btn {
        margin: 16rpx 30rpx 0 30rpx;
    }
}
</style>
